﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Kangou
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (radioButton1.Checked == true)
            {
                saveFileDialog1.ShowDialog();
                textBox1.Text = saveFileDialog1.FileName;
            }
            else
            {
                openFileDialog1.ShowDialog();
                textBox1.Text = openFileDialog1.FileName;
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            if (radioButton1.Checked == true)
            {
                saveFileDialog2.ShowDialog();
                textBox2.Text = saveFileDialog1.FileName;
            }
            else
            {
                openFileDialog2.ShowDialog();
                textBox2.Text = openFileDialog1.FileName;
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            if (radioButton1.Checked == false)
            {
                saveFileDialog3.ShowDialog();
                textBox3.Text = saveFileDialog3.FileName;
            }
            else
            {
                openFileDialog3.ShowDialog();
                textBox3.Text = openFileDialog3.FileName;
            }
        }

        private void button4_Click(object sender, EventArgs e)
        {
            CryptLogic cl = new CryptLogic();
            if(radioButton1.Checked == true)
            {
                cl.encFile(textBox1.Text, textBox2.Text, textBox3.Text);
                MessageBox.Show("完了しました");
            }
            else
            {
                cl.decFile(textBox1.Text, textBox2.Text, textBox3.Text);
                MessageBox.Show("完了しました");
            }
        }
    }
}